﻿using System;
using System.Diagnostics;
using System.Xml.Serialization;
using PrearrangedChaos.AgileZen.Service.Rest;

namespace PrearrangedChaos.AgileZen.Service.Model
{
    /// <remarks/>
    [DebuggerStepThrough()]
    [XmlType(AnonymousType = true)]
    [XmlRootAttribute(ElementName = "invite", Namespace = "", IsNullable = false)]
    [ZenRestRequest("projects/{ProjectId}/invites/{InviteId}", "projects/{ProjectId}/invites")]
    public partial class Invite : IInvite
    {
        private IRole _role;
        private IUser _sender;

        /// <remarks/>
        [XmlElement(ElementName = "createTime")]
        public DateTime CreateTime { get; set; }

        public bool CreateTimeSpecified { get { return this.CreateTime != DateTime.MinValue; } }

        /// <remarks/>
        [XmlElement(ElementName = "email")]
        public string Email { get; set; }

        public bool EmailSpecified { get { return this.Email != null; } }

        /// <remarks/>
        [XmlElement(ElementName = "id")]
        public int Id { get; set; }

        public bool IdSpecified { get { return this.Id > 0; } }

        /// <remarks/>
        [XmlElement(ElementName = "role")]
        public Role RoleXmlElement
        {
            get
            {
                return this._role as Role;
            }
            set
            {
                this._role = value;
            }
        }

        [XmlIgnore]
        public IRole Role
        {
            get
            {
                return this._role;
            }
            set
            {
                this._role = value;
            }
        }

        /// <remarks/>
        [XmlElement(ElementName = "sender")]
        public User SenderXmlElement
        {
            get
            {
                return this._sender as User;
            }
            set
            {
                this._sender = value;
            }
        }

        /// <remarks/>
        [XmlIgnore]
        public IUser Sender
        {
            get
            {
                return this._sender;
            }
            set
            {
                this._sender = value;
            }
        }


        /// <remarks/>
        [XmlElement(ElementName = "token")]
        public string Token { get; set; }

        public bool TokenSpecified { get { return !string.IsNullOrEmpty(this.Token); } }
    }
}